package com.yxq.mdt.app.modules.search.ui;

import androidx.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.yxq.mdt.app.R;
import com.yxq.mdt.app.glide.GlideHelper;
import com.yxq.mdt.app.modules.search.bean.SearchBean;

import java.util.List;

/**
 * @author L
 * @time 2019-10-21
 * @describe 搜索-商品搜索列表
 */
public class SearchGoodsListAdapter extends BaseQuickAdapter<SearchBean.ListBean, BaseViewHolder> {

    public SearchGoodsListAdapter(int layoutResId, @Nullable List<SearchBean.ListBean> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, SearchBean.ListBean item) {

        helper.setText(R.id.main_item_tv_grid_title, item.getName());
        helper.setText(R.id.main_item_tv_grid_sell_price, String.format("￥%.2f", item.getPrice()));
        GlideHelper.setLoadRoundImage(mContext, item.getPic_url(), 0, helper.getView(R.id.main_item_iv_grid_icon));
    }

}
